package com.ruoyi.business.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.JtSupplierRatingMapper;
import com.ruoyi.business.domain.JtSupplierRating;
import com.ruoyi.business.service.IJtSupplierRatingService;
import com.ruoyi.common.core.text.Convert;

/**
 * 供应商评分Service业务层处理
 * 
 * @author Alan Zhang
 * @date 2025-05-22
 */
@Service
public class JtSupplierRatingServiceImpl implements IJtSupplierRatingService 
{
    @Autowired
    private JtSupplierRatingMapper jtSupplierRatingMapper;

    /**
     * 查询供应商评分
     * 
     * @param ratingId 供应商评分主键
     * @return 供应商评分
     */
    @Override
    public JtSupplierRating selectJtSupplierRatingByRatingId(Long ratingId)
    {
        return jtSupplierRatingMapper.selectJtSupplierRatingByRatingId(ratingId);
    }

    /**
     * 查询供应商评分列表
     * 
     * @param jtSupplierRating 供应商评分
     * @return 供应商评分
     */
    @Override
    public List<JtSupplierRating> selectJtSupplierRatingList(JtSupplierRating jtSupplierRating)
    {
        return jtSupplierRatingMapper.selectJtSupplierRatingList(jtSupplierRating);
    }

    /**
     * 新增供应商评分
     * 
     * @param jtSupplierRating 供应商评分
     * @return 结果
     */
    @Override
    public int insertJtSupplierRating(JtSupplierRating jtSupplierRating)
    {
        jtSupplierRating.setCreateBy(ShiroUtils.getSysUser().getUserName());
        jtSupplierRating.setCreateTime(DateUtils.getNowDate());
        return jtSupplierRatingMapper.insertJtSupplierRating(jtSupplierRating);
    }

    /**
     * 修改供应商评分
     * 
     * @param jtSupplierRating 供应商评分
     * @return 结果
     */
    @Override
    public int updateJtSupplierRating(JtSupplierRating jtSupplierRating)
    {
        return jtSupplierRatingMapper.updateJtSupplierRating(jtSupplierRating);
    }

    /**
     * 批量删除供应商评分
     * 
     * @param ratingIds 需要删除的供应商评分主键
     * @return 结果
     */
    @Override
    public int deleteJtSupplierRatingByRatingIds(String ratingIds)
    {
        return jtSupplierRatingMapper.deleteJtSupplierRatingByRatingIds(Convert.toStrArray(ratingIds));
    }

    /**
     * 删除供应商评分信息
     * 
     * @param ratingId 供应商评分主键
     * @return 结果
     */
    @Override
    public int deleteJtSupplierRatingByRatingId(Long ratingId)
    {
        return jtSupplierRatingMapper.deleteJtSupplierRatingByRatingId(ratingId);
    }
}
